package com.woniuxy.service.impl;


import com.woniuxy.entity.SysDoctor;
import com.woniuxy.mapper.SysDoctorMapper;
import com.woniuxy.service.SysDoctorService;
import com.woniuxy.util.ResponseEnum;
import com.woniuxy.util.ResponseUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 系统医生服务实现类
 * 实现系统医生相关的业务逻辑
 */
@Service
public class SysDoctorServiceImpl implements SysDoctorService {
    @Resource
    private SysDoctorMapper sysDoctorMapper;

    /**
     * 查询所有系统医生
     * @return 返回所有系统医生的响应结果
     */
    @Override
    public ResponseUtil findAllSysDoctor() {
        List<SysDoctor> allSysDoctor = sysDoctorMapper.findAllSysDoctor();
        return allSysDoctor.size()>0?ResponseUtil.get(ResponseEnum.OK,allSysDoctor)
                :ResponseUtil.get(ResponseEnum.FAIL);
    }

    /**
     * 根据组织名称和团队名称查询系统医生
     * @param orgName 组织名称
     * @param teamName 团队名称
     * @return 返回指定组织和团队的医生信息
     */
    @Override
    public ResponseUtil findSysDoctor(String orgName, String teamName) {
        List<SysDoctor> sysDoctor = sysDoctorMapper.findSysDoctor(orgName, teamName);
        return sysDoctor.size()>0?ResponseUtil.get(ResponseEnum.OK,sysDoctor)
                :ResponseUtil.get(ResponseEnum.FAIL);
    }
}
